#!/usr/bin/python
# -*- coding: UTF-8 -*-


#
# outputs config files to all of target folders
# @param [outputFolderUrls] target folders
# @param [excelConfigDatas] excel contents
#
def Run(outputFolderUrls, excelConfigDatas):
    for i in range(len(outputFolderUrls)):
        outputFolderUrl = outputFolderUrls[i]
        _DoRun(outputFolderUrl, excelConfigDatas)

#
# outputs config file to a target folder
# @param [outputFolderUrl] a target folder
# @param [excelConfigDatas] excel contents
#
def _DoRun(outputFolderUrl, excelConfigDatas):
    #output all of config files in turn
    excelCount = len(excelConfigDatas)
    for i in range(excelCount):
        #starts to write content string
        excelContentStr = "[\r\n"
        excelConfigData = excelConfigDatas[i]

        #writes all of line content string in turn
        excelLineCount = excelConfigData.GetLineCount()
        for j in range(excelLineCount):
            excelLineData = excelConfigData.GetLineData(j)

            #writes a line content
            excelContentStr += "    {"

            #writes all of data content in turn
            excelElementCount = excelLineData.GetCount()
            for k in range(excelElementCount):
                excelElementData = excelLineData.GetData(k)

        #saves the config data to disk